package com.haste.controller;

import com.haste.pojo.Dept;
import com.haste.service.DeptClientService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName:DeptController
 * @Description:
 * @Author:Haste
 * @Date:2021/2/2 9:31
 */
@RestController
public class DeptController {
    @Resource
    private DeptClientService deptClientService = null;

    @RequestMapping(value = "/consumer/dept/get/{deptId}",method = RequestMethod.GET)
    public Dept get(@PathVariable("deptId") Long deptId){
        return this.deptClientService.queryById(deptId);
    }

    @RequestMapping(value = "/consumer/dept/add",method = RequestMethod.POST)
    public boolean add(@RequestBody Dept dept){
        return this.deptClientService.addDept(dept);
    }

    @RequestMapping(value = "/consumer/dept/list",method = RequestMethod.GET)
    public List<Dept> list(){
        return this.deptClientService.queryAll();
    }
}
